// components/base/top-safe-area/index.js
import { getMenuButtonBoundingClientRect } from '../../../common/env';
Component({
    properties: {
        // 是否包含顶部导航栏
        containsHeader: {
            type: Boolean,
            value: false,
        },
    },
    data: {
        styleValue: '',
    },
    lifetimes: {
        // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
        attached: function () {
            const obj = getMenuButtonBoundingClientRect();
            const { containsHeader } = this.data;
            this.setData({
                styleValue: `height: ${containsHeader ? obj.bottom : obj.top}px;`,
            });
        },
    },
})